<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="style.css">
    <title>按钮文字上下滑动</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
            transition: .5s;
        }

        html,
        body {
            background-color: #efefef;
            color: #fff;
            font-size: 14px;
        }

        .app {
            width: 100%;
            height: 100vh;
            position: relative;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        button {
            width: 110px;
            height: 42px;
            color: #ffffff;
            background-color: #457356;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.3s linear;
            position: relative;
            overflow: hidden;
        }

        .defalut,
        .hover {
            width: 100%;
            height: 100%;
            line-height: 42px;
            letter-spacing: 2px;
            display: block;
            transition: all 0.3s ease-in-out;
            cursor: pointer;
        }

        .hover {
            position: absolute;
            left: 0;
            top: 100%;
        }

        button:hover .defalut {
            transform: translateY(-100%);
        }

        button:hover .hover {
            top: 0;
        }
    </style>
</head>

<body>
    <div class="app">
        <button>
            <span class="defalut">鼠标放上来</span>
            <span class="hover">点我吧</span>
        </button>
    </div>
</body>

</html>